package com.atguigu.memonto.theory;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description:
 * @create: 2022-03-10 17:37
 **/
public class Client {
    public static void main(String[] args) {
        Originator originator = new Originator();
        CareTaker careTaker = new CareTaker();

        originator.setState(" 状态#01 攻击力100");
        //保存01的状态
        careTaker.add(originator.saveStateToMemento());

        originator.setState(" 状态#02 攻击力80");
        //保存02的状态
        careTaker.add(originator.saveStateToMemento());

        originator.setState(" 状态#01 攻击力30");
        //保存03的状态
        careTaker.add(originator.saveStateToMemento());

        System.out.println("当前的状态是= "+ originator.getState());

        //希望得到状态01， 将originator 恢复状态 1
        originator.getStateFromMemento(careTaker.get(0));
        System.out.println("恢复的状态 01 是= "+ originator.getState());
    }
}
